/*
 *    Copyright (C) 2011-2012 Hai Bison
 *
 *    See the file LICENSE at the root directory of this project for copying
 *    permission.
 */

package group.pals.mailgate.ui;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Table cell renderer.
 */
public class RightAlignCellRenderer extends DefaultTableCellRenderer {

    private int cellHorzAlignment;

    public void setCellHorzAlignment(int alignment) {
        cellHorzAlignment = alignment;
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
                row, column);
        setHorizontalAlignment(cellHorzAlignment);
        return this;
    }
}
